<template>
  <div class="main">
    <el-container class="main-contain">
      <!-- 折叠是60px,不折叠是200px,默认为false不折叠 -->
      <el-aside :width="isFold ? '70px' : '220px'">
        <MainMenu :is-fold="isFold" />
      </el-aside>
      <el-container>
        <el-header>
          <MainHeader @foldChange="handleFoldChange" />
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import MainMenu from '@/components/main-menu/main-menu.vue'
import MainHeader from '@/components/main-header/main-header.vue'
// 子组件传递的数据
const isFold = ref(false)
const handleFoldChange = (flag: boolean) => {
  isFold.value = flag
}
</script>

<style lang="less" scoped>
.main {
  height: 100%;
  .main-contain {
    height: 100%;
    .el-aside {
      background-color: #b45959;
    }
    .el-aside {
      overflow-x: hidden;
      overflow-y: auto;
      line-height: 200px;
      text-align: left;
      cursor: pointer;
      background-color: #001529;
      transition: width 0.3s linear;
      scrollbar-width: none; /* firefox */
      -ms-overflow-style: none; /* IE 10+ */

      &::-webkit-scrollbar {
        display: none;
      }
    }
  }
  .el-main {
    background-color: #f0f2f5;
  }
}
</style>
